package com.easyaop.api.support;

import org.objectweb.asm.Type;

final class FieldSignature {
    private final String name;

    private final Type type;

    public FieldSignature(String name, Type type) {
        if (name.indexOf('(') >= 0) {
            throw new IllegalArgumentException("name '" + name + "' is invalid");
        }
        this.name = name;
        this.type = type;
    }

    public FieldSignature(String name, Class<?> type) {
        this(name, Type.getType(type));
    }

    public String getName() {
        return name;
    }

    public String getDescriptor() {
        return type.getDescriptor();
    }

    public Type getType() {
        return type;
    }
}